package com.wust.controller;

import com.wust.common.ServerResponse;
import com.wust.service.IStatisticsService;
import com.wust.vo.BMIVo;
import com.wust.vo.HeartRateVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.security.SecureRandom;

/**
 * Created by lenovo on 2018/6/13.
 */
@RestController
@RequestMapping("/api/statistics")
@EnableSwagger2
@Api(value = "statistics", description = "统计数据接口")
public class StatisticsController {

    @Autowired
    private IStatisticsService iStatisticsService;

    @ApiOperation("获得用户当前的BMI分析")
    @PostMapping("/dogetUserCurrentBMI")
    public ServerResponse<BMIVo> getUserCurrentBMI(String userId){
        return iStatisticsService.getUserCurrentBMI(Integer.valueOf(userId));
    }

//    @ApiOperation("获得某一用户最近行程的血压统计")
//    @PostMapping("/dogetOneBloodStatistics")
//    public ServerResponse getOneBloodStatistics(String userId){
//        return null;
//    }

    @ApiOperation("获得某一用户最近行程的心率统计")
    @PostMapping("/dogetOneHeartStatistics")
    public ServerResponse<HeartRateVo> getOneHeartStatistics(String userId){
        return iStatisticsService.getOneHeartStatistics(Integer.valueOf(userId));
    }

//    //获取周统计结果
//    @ApiOperation("获取某一用户一周血压统计结果")
//    @PostMapping("/dogetWeekBloodStatistics")
//    public ServerResponse getWeekBloodStatistics(String userId){
//        return null;
//    }

    //获取周统计结果
    @ApiOperation("获取某一用户一周心率统计结果")
    @PostMapping("/dogetWeekHeartStatistics")
    public ServerResponse getWeekHeartStatistics(String userId){
        return iStatisticsService.getWeekHeartStatistics(Integer.valueOf(userId));
    }



}
